<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="static/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link href="static/admin/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="static/admin/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
    <link href="static/admin/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="static/admin/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="static/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>后台登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
    <div id="loginform" class="loginBox">
        <form class="form form-horizontal" action="" id="myForm">
            <div class="row cl">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                <div class="formControls col-xs-8">
                    <input name="name" type="text" placeholder="账户" class="input-text size-L">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                <div class="formControls col-xs-8">
                    <input name="password" type="password" placeholder="密码" class="input-text size-L">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe6bf;</i></label>
                <div class="formControls col-xs-8">
                    <input class="input-text size-L" name="captcha" type="captcha" placeholder="验证码"   style="width:150px;">&nbsp;&nbsp;
                    <img style="cursor:pointer;" src="{:captcha_src()}" alt="captcha" onclick="javascript:this.src='{:captcha_src()}?tm='+Math.random();"/>
                </div>
            </div>
            <div class="row cl">

            </div>
            <div class="row cl">
                <div class="formControls col-xs-8 col-xs-offset-3">
                    <input class="btn btn-success radius size-L" type="button" onclick="login_id(form)" value="登录"/>
                </div>
            </div>
        </form>

    </div>
</div>
<script type="text/javascript" src="static/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="static/admin/h-ui/js/H-ui.min.js"></script>

<script src="static/admin/layer/layer.js"></script>
<script type="text/javascript">
    function login_id(form){
        if(form.name.value==''){
            layer.msg('用户名不能为空！',{icon:2,time:1000});
            return false;
        }
        if(form.password.value==''){
            layer.msg('密码不能为空！',{icon:2,time:1000});
            return false;
        }
        if(form.captcha.value==''){
            layer.msg('验证码不能为空！',{icon:2,time:1000});
            return false;
        }
        $.ajax({
            url:'login',
            type:'post',
            dataType:'json',
            data:$("#myForm").serialize(),
            success:function(data){
                if (data.code !== 200) {
                    layer.msg(data.msg,{icon:2,time:1000});
                    return false;
                }else if(data.code == 200) {
                    layer.msg('登录成功',{icon:1,time:1000});
                    setTimeout(function () {
                        window.parent.location.reload();
                        parent.layer.close();
                        location.href="/admin";
                    },1000);
                }
            },
        });
    };

</script>
</body>
</html>